<?php require_once('../core.php'); ?>
<?php
/**
* Manager Cookies
*
* 管理Cookies统一调用接口
*/
class Cookies
{
    public static function setPrimarykey($primaryKey,$expire='none')
    {
        if($expire=='none')
            return setcookie('Cedar_Manager_Primarykey', $primaryKey);
        else
            return setcookie('Cedar_Manager_Primarykey', $primaryKey,$expire);
    }

    public static function getPrimarykey()
    {
        return !empty($_COOKIE['Cedar_Manager_Primarykey']) ? $_COOKIE['Cedar_Manager_Primarykey']:NULL;
    }

    public static function setUserid($userid,$expire='none')
    {
        if($expire=='none')
            return setcookie('Cedar_Manager_Userid', $userid);
        else
            return setcookie('Cedar_Manager_Userid', $userid,$expire);
    }

    public static function getUserid()
    {
        return !empty($_COOKIE['Cedar_Manager_Userid']) ? $_COOKIE['Cedar_Manager_Userid']:NULL;
    }
    
    public static function setPassword($password,$expire='none')
    {
        if($expire=='none')
            return setcookie('Cedar_Manager_Password', $password);
        else
            return setcookie('Cedar_Manager_Password', $password,$expire);
    }
    
    public static function getPassword()
    {
        return !empty($_COOKIE['Cedar_Manager_Password']) ? $_COOKIE['Cedar_Manager_Password']:NULL;
    }

    public static function setRole($role,$expire='none')
    {
        if($expire=='none')
            return setcookie('Cedar_Manager_Role', $role);
        else
            return setcookie('Cedar_Manager_Role', $role,$expire);
    }
    
    public static function getRole()
    {
        return $_COOKIE['Cedar_Manager_Role'];
    }
}
?>